package com.artwork.service.impl;

import com.artwork.mapper.GoodsMapper;
import com.artwork.model.Goods;
import com.artwork.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author JoJo
 * @Data 2021/9/9$ 14:11$
 * @Description
 * @Param $
 * @Return $
 */
@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    GoodsMapper goodsMapper;

    @Override
    public List<Goods> getList() {
        return goodsMapper.getList();
    }

    @Override
    public List<Goods> getListByType(int type) {
        return goodsMapper.getListByType(type);
    }

    @Override
    public List<Goods> getListByParams(Goods goods) {
        return goodsMapper.getListByParams(goods);
    }

    @Override
    public List<Goods> getUserList(int sellerId) {
        return goodsMapper.getUserList(sellerId);
    }

    @Override
    public int addGoos(Goods goods) {
        return goodsMapper.insertSelective(goods);
    }

    @Override
    public Goods getGoodsById(Integer id) {
        return goodsMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateGoods(Goods goods) {
        return goodsMapper.updateByPrimaryKeySelective(goods);
    }

    @Override
    public int pushGoods(int id, int status) {
        return goodsMapper.pushGoods(id, status);
    }

    @Override
    public int deleteGoods(int id) {
        return goodsMapper.deleteGoods(id);
    }
}
